import pandas as pd

# 读取词典文件
data = pd.read_csv('dict/dict.txt.small', sep=' ', header=None, names=['词汇', '频率', '词性标注'])
print(data.head())
# 筛选适合的词性
selected_pos = ['n', 'v', 'a', 'd', 'm']
filtered_data = data[data['词性标注'].isin(selected_pos)]

# 保存筛选后的词典
filtered_data.to_csv('dict/filtered_dict.dat', index=False, sep='\t', header=False)
